package com.fr.report;

import com.fr.base.FRContext;
import com.fr.base.StringUtils;
import com.fr.base.dav.Env;
import com.fr.base.xml.XMLPrintWriter;
import com.fr.base.xml.XMLableReader;
import com.fr.data.TableData;
import com.fr.report.io.ReportExportAttr;
import com.fr.report.parameter.Parameter;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;

public class LinkWorkBookTemplate
  implements TemplateWorkBook
{
  private String tplPath;
  private transient TemplateWorkBook realTemplate;

  public String getTemplatePath()
  {
    return this.tplPath;
  }

  public void setTemplatePath(String paramString)
  {
    this.tplPath = paramString;
  }

  private TemplateWorkBook createWorkBookTemplate()
  {
    if (this.realTemplate == null)
      try
      {
        this.realTemplate = FRContext.getCurrentEnv().readTemplate(this.tplPath);
      }
      catch (Exception localException)
      {
        FRContext.getLogger().log(Level.WARNING, localException.getMessage(), localException);
        this.realTemplate = new WorkBook();
      }
    return this.realTemplate;
  }

  public ResultWorkBook execute(Map paramMap)
  {
    return createWorkBookTemplate().execute(paramMap);
  }

  public ResultWorkBook execute4Write(Map paramMap)
  {
    return createWorkBookTemplate().execute4Write(paramMap);
  }

  public ResultWorkBook execute4Form(Map paramMap)
  {
    return createWorkBookTemplate().execute4Form(paramMap);
  }

  public PageSetChain generateReportPageSet(List paramList)
  {
    return createWorkBookTemplate().generateReportPageSet(paramList);
  }

  public Parameter[] getParameters()
  {
    return createWorkBookTemplate().getParameters();
  }

  public void readXML(XMLableReader paramXMLableReader)
  {
    if ((paramXMLableReader.isChildNode()) && ("Path".equals(paramXMLableReader.getTagName())))
      setTemplatePath(paramXMLableReader.getElementValue());
  }

  public void writeXML(XMLPrintWriter paramXMLPrintWriter)
  {
    if (StringUtils.isNotBlank(this.tplPath))
      paramXMLPrintWriter.startTAG("Path").textNode(this.tplPath).end();
  }

  public void clearAllTableData()
  {
    throw new UnsupportedOperationException();
  }

  public ReportParameterAttr getReportParameterAttr()
  {
    return createWorkBookTemplate().getReportParameterAttr();
  }

  public ReportWebAttr getReportWebAttr()
  {
    return createWorkBookTemplate().getReportWebAttr();
  }

  public TableData getTableData(String paramString)
  {
    return createWorkBookTemplate().getTableData(paramString);
  }

  public Iterator getTableDataNameIterator()
  {
    return createWorkBookTemplate().getTableDataNameIterator();
  }

  public void putTableData(String paramString, TableData paramTableData)
  {
    throw new UnsupportedOperationException();
  }

  public void removeTableData(String paramString)
  {
    throw new UnsupportedOperationException();
  }

  public boolean renameTableData(String paramString1, String paramString2)
  {
    throw new UnsupportedOperationException();
  }

  public void setReportParameterAttr(ReportParameterAttr paramReportParameterAttr)
  {
    throw new UnsupportedOperationException();
  }

  public void setReportWebAttr(ReportWebAttr paramReportWebAttr)
  {
    throw new UnsupportedOperationException();
  }

  public Object clone()
    throws CloneNotSupportedException
  {
    return super.clone();
  }

  public void addReport(TemplateReport paramTemplateReport)
  {
    throw new UnsupportedOperationException();
  }

  public void addReport(String paramString, TemplateReport paramTemplateReport)
  {
    throw new UnsupportedOperationException();
  }

  public Report getReport(int paramInt)
  {
    return createWorkBookTemplate().getReport(paramInt);
  }

  public int getReportCount()
  {
    return createWorkBookTemplate().getReportCount();
  }

  public int getReportIndex(TemplateReport paramTemplateReport)
  {
    return createWorkBookTemplate().getReportIndex(paramTemplateReport);
  }

  public String getReportName(int paramInt)
  {
    return createWorkBookTemplate().getReportName(paramInt);
  }

  public void removeReport(String paramString)
  {
    throw new UnsupportedOperationException();
  }

  public void removeReport(int paramInt)
  {
    throw new UnsupportedOperationException();
  }

  public void removeReports()
  {
    throw new UnsupportedOperationException();
  }

  public void setReport(int paramInt, TemplateReport paramTemplateReport)
  {
    throw new UnsupportedOperationException();
  }

  public void setReport(int paramInt, String paramString, TemplateReport paramTemplateReport)
  {
    throw new UnsupportedOperationException();
  }

  public void setReportName(int paramInt, String paramString)
  {
    throw new UnsupportedOperationException();
  }

  public ReportExportAttr getReportExportAttr()
  {
    return createWorkBookTemplate().getReportExportAttr();
  }

  public void setReportExportAttr(ReportExportAttr paramReportExportAttr)
  {
    throw new UnsupportedOperationException();
  }

  public TemplateReport getTemplateReport(int paramInt)
  {
    return createWorkBookTemplate().getTemplateReport(paramInt);
  }

  public void apply4Parameters(Map paramMap)
  {
    createWorkBookTemplate().apply4Parameters(paramMap);
  }
}